# !/usr/bin/python
# _*_ coding: utf-8 _*_
# @Time : 2021/5/25 3:28 下午
# @Author : liujun
# @File : sys_user.py
# @desc : 系统用户CURD
from sqlalchemy.orm import Session

from models import SysUser
from service.base import Base
from schemas.request.sys_user import SysUserAdd, SysUserUpd


class BambooSort(Base[SysUser, SysUserAdd, SysUserUpd]):

    def get_list(self, db: Session, page_number: int, page_size: int, sort_name: str, sort_order: str,
                 login_name: str, state: int):
        filters = {}
        if login_name is not None:
            filters['login_name_like'] = login_name
        if state is not None:
            filters['state'] = state
        return self.get_multi(db, filters=filters,
                              sort_name=sort_name, sort_order=sort_order, page_number=page_number, page_size=page_size)


SysUserService = BambooSort(SysUser)
